package com.banyuan.HomeWork.多线程;

import java.util.ArrayList;

public class Shop implements Runnable {
    private int coldNum;
    private int hotNum;
    private int bakeTime;
    private int bakeNum;
    private int runTime;
    private ArrayList<Customer> listCustomer = new ArrayList<>();
    private ArrayList<Shopper> listShopper = new ArrayList<>();

    public void bake(Shopper s) {
        if (getColdNum() >= getBakeNum()) {
            setHotNum(getHotNum() + getBakeNum());
            setColdNum(getColdNum() - getBakeNum());
        }
    }

    public void get(Customer c) {
        if(getHotNum() >= c.getI())
        c.get(this);
    }

    public void put(Shopper s) {
        s.put(this);
    }

    public Shop(int coldNum, int hotNum, int bakeTime, int bakeNum, int runTime) {
        this.coldNum = coldNum;
        this.hotNum = hotNum;
        this.bakeTime = bakeTime;
        this.bakeNum = bakeNum;
        this.runTime = runTime;
    }

    public int getColdNum() {
        return coldNum;
    }

    public void setColdNum(int coldNum) {
        this.coldNum = coldNum;
    }

    public int getHotNum() {
        return hotNum;
    }

    public void setHotNum(int hotNum) {
        this.hotNum = hotNum;
    }

    public int getBakeTime() {
        return bakeTime;
    }

    public void setBakeTime(int bakeTime) {
        this.bakeTime = bakeTime;
    }

    public int getBakeNum() {
        return bakeNum;
    }

    public void setBakeNum(int bakeNum) {
        this.bakeNum = bakeNum;
    }

    public int getRunTime() {
        return runTime;
    }

    public void setRunTime(int runTime) {
        this.runTime = runTime;
    }

    @Override
    public void run() {
        for (int i = 1; i <= runTime; i++) {
            for (Customer customer : listCustomer) {

            }

        }
    }
}
